home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 June / PCpro_2005_06.ISO / files / opensource / truedownloader / SetupTrueDownloader.exe / {app} / truedownloader.xpi / install.js next >
Encoding:
Text File  |  2004-12-27  |  1.7 KB  |  53 lines

  1.  
  2. const gName        = "TrueDownloader";
  3. const gAuthor        = "Sylvain Dupont";
  4. const gRegKey        = "/TrueDownloader/FireFox";
  5. const gVersion        = "0.8";
  6. const gJar            = "truedownloader.jar";
  7.  
  8. var    error             = null;
  9. var oFolder            = getFolder("Current User", "chrome");
  10. var iContentFlag    = CONTENT | PROFILE_CHROME;
  11.  
  12. // Install in App or Profile?
  13. var existsInApplication = File.exists(getFolder(getFolder("chrome"), gJar));
  14. var existsInProfile     = File.exists(getFolder(oFolder, gJar));
  15. //if(existsInApplication || (!existsInProfile && !confirm("Do you want to install the extension into your profile folder?\n(Cancel will install into the application folder)")))
  16. //{
  17. //    iContentFlag = CONTENT | DELAYED_CHROME;
  18. //    oFolder      = getFolder("chrome");
  19. //}
  20.  
  21. // Uninstall Current
  22. if(existsInApplication || existsInProfile)
  23.     uninstall(gRegKey);
  24.  
  25. // Init
  26. initInstall(gName, gRegKey, gVersion);
  27. setPackageFolder(oFolder);
  28. error = addFile(gAuthor, gVersion, "chrome/"+ gJar, oFolder, null);
  29. error = addFile(gAuthor, gVersion, "TDLauncher.exe", oFolder, null);
  30. // Register
  31. if(error == SUCCESS){
  32.     registerChrome(iContentFlag, getFolder(oFolder, gJar), "content/");
  33.     
  34.     error = performInstall(); //Install
  35.     
  36.     if(error != SUCCESS && error != 999){
  37.         switch(error){
  38.             case -215:
  39.                 alert("The installation of the extension failed.\nOne of the files being overwritten is read-only.");
  40.                 break;
  41.             case -235:
  42.                    alert("The installation of the extension failed.\nThere is insufficient disk space.");
  43.                 break;
  44.             default: 
  45.                 alert("The installation of the extension failed.\nThe error code is: " + error);
  46.         }
  47.         cancelInstall(error);
  48.     }
  49. }
  50. else{
  51.     alert("The installation failed.\n" + error);
  52.     cancelInstall(error);
  53. }